Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest upstream changes #16

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Conversation

vocksel
Copy link

@vocksel vocksel commented Aug 17, 2024

This PR merges the latest changes from commit 70f4243 in Roblox/jest-roblox

A new package JestMockGenv is included with these changes, and I'm hitting some build issues because of it. Seems like this package may need to be published to the jsdotlua npm scope first.

Checklist before submitting:

  • Tidy up merge artifacts
  • Added/updated relevant tests
  • Added/updated documentation

RoFlection Bot and others added 19 commits March 11, 2024 10:10
## Problem
[APT-328](https://roblox.atlassian.net/browse/APT-328)

## Solution
Align and complete implementation of `spyOn` function

## Testing
Aligned a number of tests, including further tests for already-ported
logic.
The type in the export is incorrect

See here

https://github.com/Roblox/jest-roblox-internal/blob/master/src/jest-runtime/src/init.lua#L2450

Updating and bumping to be moduleScript instead of string

---------
Updating changelog and bumping release version for 3.7.0. Needed for the vscode extension.
Mocking task.wait directly in jest as per suggestion of @LordOfSpelunky
## Problem
Projects using the registry cannot consume new versions of Jest

## Solution
Configre Jest to use the registry

## Testing
Describe how the solution was tested (ideally unit tests). If done
manually, describe the process and outcome.

## Checklist (remove if not applicable)
- [ ] For new modules, has a README.md file with notes about the
translation
- [ ] All deviations are notated in code with `-- ROBLOX deviation:
comment`
- [ ] Translated files include a comment with a link to the upstream
file
## Problem
The `spyOn` function does not currently work with Lua globals because
those tables are not mockable in the usual way.

## Solution
Adds `jest.globalEnv` which can be used with `spyOn` to mock Lua globals
in a test environment. Allows access to the unmocked globals as members
too.

## Testing
Added new unit test cases to cover API surface.

## Checklist (remove if not applicable)
- [x] For new modules, has a README.md file with notes about the
translation
- [x] All deviations are notated in code with `-- ROBLOX deviation:
comment`
- [x] Translated files include a comment with a link to the upstream
file
## Problem
Jest assumes that all properties listed in the Roblox API are safe to
index. This is not true when encountering properties that are only
accessible to privileged code while Jest is running in a less privileged
context, or when otherwise dealing with properties that have the
potential to error on index.

## Solution
Hide details of the Roblox API inside of RobloxInstance, and instead
only expose 'safe' APIs that protect around all instance reads and
writes, and expose only the properties which are accessible with the
script's current capabilities.

## Testing
Unit tests and snapshots.
Moved all jest docs links to point to the 27.x archived version of the
jest docs and updated static assets correctly the docusaurus way.
…st environment (#405)

## Problem
When Jest 2 users are in the midst of updating to Jest 3, they might
attempt to pull in Jest 3 globals.

https://roblox.slack.com/archives/C04N86WJA4R/p1721837297468429?thread_ts=1721815127.913289&cid=C04N86WJA4R

## Solution
Update the JestGlobals error to include a tip about mixing Jest 2 and
Jest 3.

## Testing
Unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant